#include<iostream>
#include"UdpServer.hpp"
#include"log.hpp"
#include"InetAddr.hpp"
#include<string>
#include"Massageroute.hpp"
#include<memory>
void Usage(std::string str)
{
    std::cout<<"Usage:\n\t"<<str<<" _local_port\n"<<std::endl;
}
int main(int argc,char*argv[])
{
    if(argc !=2 )
    {
        Usage(argv[0]);
        exit(USAGE_ERROR);
    }
    Massageroute mge;
    EnableScrean();
    uint16_t port = std::stoi(argv[1]);//端口号
    std::unique_ptr<UdpServer> uptr = std::make_unique<UdpServer>(port,\
    std::bind(&Massageroute::Route,&mge,std::placeholders::_1,std::placeholders::_2,std::placeholders::_3));
    //使用Massageroute类中Route成员函数绑定到mge对象，
    uptr->InitServer();
    uptr->Start();
    return 0;
}

